package com.mkx.controller;

import com.mkx.model.Restaurant;
import com.mkx.service.RestaurantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class RestaurantController {
    @Autowired
    private RestaurantService service;

    @GetMapping("/restaurants")
    public List<Restaurant> getRestaurants(@RequestParam(required = false) String name) {
        // 如果提供了name参数，可以在这里过滤列表
        return service.findAllRestaurants();
    }
}
